import 'dart:collection';

import 'package:flutter/services.dart';

import 'MMKVUtil.dart';

class RoutUtil {
//获取方法通道final
  final _platform = const MethodChannel('hybrid_route');

  RoutUtil._privateConstructor();

  static final RoutUtil instance = RoutUtil._privateConstructor();

  jumpNative() {
    var num = MMKVUtil.instance.getInt("startNativePageNum") ?? 1;
    final Map<String, dynamic> params = {'startNativePageNum': num++};
    _platform.invokeMethod("openNativePage1", params);
  }

  closeFlutterPage() {
    _platform.invokeMethod('closeFlutterPage');
  }

  Future<T?> getPageName<T>() async {
    var pageName = await _platform.invokeMethod("startFlutterPageName");
    return pageName;
  }
}
